//
//  FDMTableViewCell.m
//  UI20_网络数据请求作业
//
//  Created by dllo on 16/4/6.
//  Copyright © 2016年 付冬梅. All rights reserved.
//

#import "FDMTableViewCell.h"
#import "dataModel.h"
#import "UIImageView+WebCache.h"

@interface FDMTableViewCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIImageView *picImage;

@end
@implementation FDMTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleLabel];
        self.picImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.picImage];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.titleLabel.frame = CGRectMake(10, 10, self.contentView.frame.size.width - 20, 20);
    self.picImage.frame = CGRectMake(10, 40, self.contentView.frame.size.width - 20, 150);
}

- (void)setDataModel:(dataModel *)model {
    self.titleLabel.text = model.intro;
//    dispatch_async(dispatch_get_main_queue(), ^{
        [self.picImage sd_setImageWithURL:[NSURL URLWithString:model.coverMiddle]];
//    });
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
